package shiyan1;

import java.util.Random;
import java.util.Scanner;

public class Test1 {
    public static void main1(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入学号：");
        String id = input.next();
        System.out.println("请输入班级：");
        String cls = input.next();
        System.out.println("请输入姓名：");
        String name = input.next();
        System.out.printf("学号：%s\n班级：%s\n姓名：%s\n",id,cls,name);
    }
	public static void main2(String[] args) {
		Scanner inputScanner=new Scanner(System.in);
		System.out.print("请输入：");
		char n=inputScanner.next().charAt(0);
		if(n>='A'&&n<='Z') {
			System.out.printf("%c是大写字母", n);
		}
		else if(n>='a' && n<='z') {
			System.out.printf("%c是小写字母", n);
		}
		else {
			System.out.printf("其他字符", n);
		}
	}
	public static void main3(String[] args) {
		Scanner in = new Scanner(System.in);
		double num1, num2, ret = 0;
		char operation;
		System.out.print("请输入第一个数：");
		num1 = in.nextDouble();
		System.out.print("请输入操作符(+ - * /)：");
		operation = in.next().charAt(0);
		System.out.print("请输入第二个数：");
		num2 = in.nextDouble();
		switch (operation) {
			case '+':
				ret = num1 + num2;
				break;
			case '-':
				ret = num1 - num2;
				break;
			case '*':
				ret = num1 * num2;
				break;
			case '/':
				ret = num1 / num2;
				break;
			default:
				System.out.println("你的输入有问题，程序退出。");
		}
		System.out.printf("结果是：%.2f", ret);
	}
		public static void main4(String[] args) {
			int i = 0;
			int j = 0;
			int count = 0;
			for (i = 100; i <= 200; i++) {
				int flag = 1;
				for (j = 2; j <= Math.sqrt(i); j++) {
					if (i % j == 0) {
						flag = 0;
						break;
					}
				}
				if (flag == 1) {
					System.out.printf("%d ", i);
					count++;
					if (count % 5 == 0) {
						System.out.println();
					}
				}
			}
		}

	public static void main5(String[] args) {
		double allscr=0;
		Scanner inputScanner=new Scanner(System.in);
		int i=0;
		int j=0;
		for(i=1;i<=2;i++) {
			int sum=0;
			int num=0;
			for(j=1;j<=3;j++) {
				System.out.printf("请输入第%d个班的第%d个学生的成绩：",i,j);
				int scr=inputScanner.nextInt();
				sum=sum+scr;
				if(scr<60) {
					num++;
				}
			}
			allscr=allscr+sum;
			System.out.printf("第%d个班级的平均分：%.2f\n不及格人数为：%d\n", i,sum/2.0,num);

		}
		System.out.printf("所有班级的平均分为:%.2f",allscr/4.0);
	}

	public static void main6(String[] args) {
		System.out.println("请输入十个两位数：");
		Scanner in = new Scanner(System.in);
		int[] array= new int[10];
		int sum = 0;
		for (int i = 0; i < array.length; i++) {
			array[i] = in.nextInt();
			sum += array[i];
		}
		int max = array[0];
		for (int i = 0; i < array.length; i++) {
			if(array[i] > max) {
				max = array[i];
			}
		}
		System.out.println("最大值："+max+"\n"+"平均值："+sum+"\n");
	}

	public static void main(String[] args) {
		int [][] array = new int[5][5];
		Random num = new Random();
		int max = 0;
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				array[i][j] = num.nextInt(100);
				System.out.print(array[i][j]+" ");
				if(max < array[i][j]) {
					max = array[i][j];
				}
			}
			System.out.println();
		}
		System.out.println("最大值："+max);
	}
}
